package com.l.web.service.login;

import com.l.web.service.ServiceSupport;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.util.ServletContextAware;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;

public class LoginController extends ActionSupport implements ServletContextAware {

    private WebApplicationContext wac;

    public void setServletContext(ServletContext servletContext) {
        wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
    }

    public String execute() {
        ServiceSupport service = (ServiceSupport) wac.getBean("loginService");
        return service.execute();
    }
}
